package org.sakai.entity;

import lombok.Getter;

/**
 * 错误码枚举
 */
@Getter
public enum ErrorCode {
    UNKNOWN_ERROR(1000, "未知错误"),
    EMAIL_FORMAT_ERROR(1001,"邮箱格式错误"),
    PASSWORD_FORMAT_ERROR(1002, "密码格式错误"),
    PHONE_FORMAT_ERROR(1003, "电话格式错误"),

    ENCRYPTED_ERROR(1004, "密码加密错误"),
    USER_NOT_FOUND_ERROR(1005,"找不到对应用户"),
    PASSWORD_ERROR(1006, "密码错误"),

    VERIFY_CODE_ERROR(1007, "验证码错误"),
    VERIFY_CODE_TOO_FREQUENT_ERROR(1008, "验证码发送次数过多"),
    //
    INSERT_ERROR(2001, "数据插入失败"),
    UPDATE_ERROR(2002, "数据更新失败"),
    DELETE_ERROR(2003, "数据删除失败"),

    //MINIO
    BUCKET_NOT_EXIST(3001, "Bucket不存在"),
    CHECK_BUCKET_FAILED( 3002, "检查Bucket失败"),
    DELETE_OBJECT_FAILED(3003, "删除对象失败"),
    LIST_DIRECTORY_FAILED(3004, "列出目录失败" ),
    CREATE_FOLDER_FAILED( 3005, "创建文件夹失败"),
    UPLOAD_FILE_FAILED(3006, "上传文件失败" ),
    FILE_NOT_FOUND(3007, "文件不存在"),
    FILE_TYPE_ERROR(3008, "文件类型错误");

    private int errorCode;
    private String errorMessage;
    private ErrorCode(int errorCode, String errorMessage){
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    @Override
    public String toString() {
        return errorCode + ":" + errorMessage;
    }
}
